﻿@{
    ViewBag.Title = "总览";
    Layout = "~/Views/Shared/_LayoutITOverview.cshtml";
}
<div class="right_title2">
    <a href="@Url.Action("index", "Home")">首页</a> > IT服务 > <span>总览</span>
</div>
@*<input type="hidden" value="" id="serviceID" />*@
<input type="hidden" value="@ViewData["SiteID"]" id="siteID"/>
<input type="hidden" value="All" id="BusinessSelect" />
<div class="class">
    <div class="tab_area">
        <ul class="tab_head tabs">
            @foreach (var item in ViewBag.Sites)
            {
                if (item.ID == ViewBag.SiteID)
                { 
                <li data-local="@item.ID" data-select="true"><a href="#@item.Name">@item.Alias</a></li>
                }
                else
                { 
                <li data-local="@item.ID"><a href="#@item.Name">@item.Alias</a></li>
                }
            }
        </ul>
        <div class="tab_container">
            <div class="tab_content" id="tab1">
                <div class="tab_item">
                    <input class="Button3 ui-icons" id="All" value="总览" type="button" /><a href="" data-id="All"
                        class="link" style="display: none;">总览</a> |
                    <input class="Button3 ui-icons" id="Desk" value="服务台" type="button" style="display: none;" /><a
                        href="" data-id="Desk" class="link">服务台</a> |
                    <input class="Button3 ui-icons" id="Incident" value="事件管理" type="button" style="display: none;" /><a
                        href="" data-id="Incident" class="link">事件管理</a> |
                    <input class="Button3 ui-icons" id="Problem" value="问题管理" type="button" style="display: none;" /><a
                        href="" data-id="Problem" class="link">问题管理</a> |
                    <input class="Button3 ui-icons" id="Change" value="变更管理" type="button" style="display: none;" /><a
                        href="" data-id="Change" class="link">变更管理</a> 
                </div>
                <div class="search" id="LoadSearch">
                    <!--***********************************************************************************************-->
                </div>
                <div class="index_lr index_lr_tab">
                    <!--***********************************************************************************************-->
                </div>
                <div class="clear">
                </div>
            </div>
        </div>
    </div>
</div>
@section LeftMenu{
    <li class="VNavLeaf ui-icons">总览</li>
}
@section ScriptAndCss
{
    <script type="text/javascript">
        function initTheReport()
        {
            $('.report').load(function(){
             $(this).parent().hideLoading();
            }).error(function(){
            $(this).parent().hideLoading();
            });
            $('.report').each(function()
            {
              var method=$(this).attr("data-parameter");
              var coclass=$(this).attr("alt");
              var url="/"+coclass+"/"+method;
              url+="?sid="+$("#siteID").val()+"&bnid="+$("#serviceID").val()+"&sTime="+$("#startTime").val()+"&eTime="+$("#endTime").val()+"&_="+Math.floor((Math.random()*1000000000)+1);
              $(this).attr("src",url);
              $(this).parent().showLoading();
            });
        }

        $(document).ready(function () {
            
            $("li", "ul.tabs").click(function () {
                  $("#siteID").val($(this).attr("data-local"));
                  var ur="@Url.Action("GetSearch", "ITBusinessOverview")"+"?siteId="+$("#siteID").val();

                  $("#LoadSearch").load(ur,function(){

                       $("#Select").click(function () {
                         if ( $("#startTime").val()== "" ||  $("#endTime").val()== "") {
            alert("请输入日期后查询!");
                return;}
                            var url="@Url.Action("GetCharts", "ITBusinessOverview")"+"?select="+$("#BusinessSelect").val()+"&siteid="+$("#siteID").val();
                            $(".index_lr_tab").load(url,function()
                            {
                            initTheReport();
                            });
                       });
    
                       $("#Reset").click(function () {
                            $("#startTime").val(getDateThreeMonthStartString());
                            var date1=new Date();
                            date1.setDate(date1.getDate()+1);
                            $("#endTime").val(getDateString(date1));
                            $("#Select").click();
                       });
                       $("#startTime").datepicker();
                       $("#endTime").datepicker();
                       $("#Reset").click();
                });

                $("li", "ul.tabs").removeClass("c ui-icons"); //Remove any "active" class 
                $(this).addClass("c ui-icons"); //Add "active" class to selected tab 
            });
            $("li[data-select='true']", "ul.tabs").click();
            
            $('.link').click(function () {
                $('.link').show(0);
                $('.Button3').fadeOut(0);
                $(this).fadeOut(0);
                var aid=$(this).attr("data-id");
                $("#"+aid).show(0);
                $("#BusinessSelect").val(aid)
                $("#Select").click();
                return false;
            });
        });

    </script>
}
